#include <head.h>
int main(int argc, char const *argv[])
{
    pid_t pid=0;
    int wait_read=0;
    if (-1==(pid=fork()))
    {
        perror("fork error");
        return 0;
    }
    
    //父进程
    else if (0<pid)
    {
        printf("我是父进程");
        sleep(3);
        kill(pid,SIGSTOP);
        sleep(3);
        kill(pid,SIGCONT);
    }
    //子进程
    else if (0==pid){
        printf("我是子进程\n");
        sleep(5);
        printf("子进程结束\n");
        exit(10);
    }
    waitpid(pid,&wait_read,WUNTRACED);
    if (WIFSTOPPED(wait_read))
    {
        printf("子进程 信号暂停 %d\n",WSTOPSIG(wait_read));
    }
    printf("子进程信号暂停\n");
    waitpid(pid,&wait_read,WCONTINUED);
    if (WIFCONTINUED(wait_read))
    {
        printf("子进程已恢复继续执行\n");
    }
    printf("子进程信号恢复成功\n");
    while (1)
    {
        sleep(1);
    }
    return 0;

}
